package com.dingwei.superiordiary.app;


import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.request.RequestOptions;
import com.dingwei.superiordiary.R;
import com.dingwei.superiordiary.utils.Constants;
import com.lihao.baselibrary.app.baseApplication;
import com.lihao.baselibrary.base.BaseActivity;
import com.lihao.baselibrary.utils.GlideCircleTransform;
import com.lihao.baselibrary.utils.GlideRoundTransform;
import com.umeng.socialize.Config;
import com.umeng.socialize.PlatformConfig;
import com.umeng.socialize.UMShareAPI;
import com.umeng.socialize.common.QueuedWork;

import cn.jpush.android.api.JPushInterface;


/**
 * Created by lihao on 2018/1/10.
 */

public class MyApplication extends baseApplication {

    public static MyApplication instance;
    public static RequestOptions headOptions;
    public static RequestOptions options_circle;
    public static RequestOptions options;
    public static RequestOptions options_no_transform;
    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;


        headOptions = new RequestOptions()
                .centerCrop()
                .placeholder(R.drawable.head_default)
                .error(R.drawable.head_default)
                .transform(new GlideCircleTransform(getApplicationContext()))
                .diskCacheStrategy(DiskCacheStrategy.NONE);
        options = new RequestOptions()
                .centerCrop()
                .placeholder(R.drawable.ic_default)
                .error(R.drawable.ic_default)
                .transform(new GlideRoundTransform(getApplicationContext(),8))
                .diskCacheStrategy(DiskCacheStrategy.NONE);
        options_circle = new RequestOptions()
                .centerCrop()
                .placeholder(R.drawable.ic_default)
                .error(R.drawable.ic_default)
                .transform(new GlideCircleTransform(getApplicationContext()))
                .diskCacheStrategy(DiskCacheStrategy.NONE);
        options_no_transform = new RequestOptions()
                .centerCrop()
                .placeholder(R.drawable.ic_default)
                .error(R.drawable.ic_default)
                .diskCacheStrategy(DiskCacheStrategy.NONE);


        //开启debug模式，方便定位错误，具体错误检查方式可以查看http://dev.umeng.com/social/android/quick-integration的报错必看，正式发布，请关闭该模式
        Config.DEBUG = true;
        QueuedWork.isUseThreadPool = false;
        UMShareAPI.get(this);
        PlatformConfig.setWeixin(Constants.WX_APP_ID, Constants.WX_APPSECRET);
        PlatformConfig.setQQZone(Constants.QQ_APP_ID, Constants.QQ_APPSECRET);


        JPushInterface.setDebugMode(true); 	// 设置开启日志,发布时请关闭日志
        JPushInterface.init(this);     		// 初始化 JPush
    }
}
